package com.hmys.api.controller;

import com.hmys.api.model.WebCountry;
import com.hmys.api.response.Result;
import com.hmys.api.response.ResultCode;
import com.hmys.api.service.CountryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by chen365 on 2018/09/26.
 */
@Api(tags = "国家")
@RestController
@RequestMapping(value = "/countries")
public class CountryController {
    @Autowired
    private CountryService countryService;

    @ApiOperation(value = "列表", notes = "列表", response = WebCountry.class, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @GetMapping(value = "")
    public Object list() {
        WebCountry record = new WebCountry();
        record.setEnabled(true);
        List<WebCountry> webCountries = countryService.selectByBean(record);
        return new Result<>(ResultCode.SUCCESS, webCountries);
    }
}
